package com.cly.course;

import com.cly.entity.Subject;
import com.cly.result.JsonRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 科目服务接口
 *
 * @author by 春风能解释
 * <p>
 * 2024/9/25
 */
@FeignClient(value = "smart-village-course",
        path = "/subject",
        contextId = "SubjectFeign")
public interface SubjectFeign {

    /**
     * 根据条件查询科目表信息
     *
     * @param subject 条件
     * @return JSON
     */
    @GetMapping("/listAll")
    JsonRequest<List<Subject>> lookSubject(Subject subject);

    /**
     * 根据条件查询科目表信息
     *
     * @param current 页码
     * @param size    页长
     * @param subject 条件
     * @return JSON
     */
    @GetMapping("/list")
    JsonRequest<List<Subject>> lookSubject(@RequestParam Integer current, @RequestParam Integer size, Subject subject);

    /**
     * 新增一条科目表信息
     *
     * @param subject 科目表信息
     * @return JSON
     */
    @PostMapping
    JsonRequest<Integer> addOneSubject(@RequestBody Subject subject);

    /**
     * 修改一条科目表信息
     *
     * @param subject 科目表信息
     * @return JSON
     */
    @PutMapping
    JsonRequest<Integer> updateOneSubject(@RequestBody Subject subject);

    /**
     * 批量删除科目表信息
     *
     * @param ids 科目表id列表
     * @return JSON
     */
    @DeleteMapping
    JsonRequest<Integer> deleteSubjects(@RequestBody List<Long> ids);

    /**
     * 根据ID查询科目信息并转换为Map
     *
     * @param ids id
     * @return JSON
     */
    @PostMapping("/ids")
    JsonRequest<Map<Long, Subject>> lookSubjectMap(@RequestBody List<Long> ids);

}
